package com.wangsh.forward.system.pojo;

import java.util.Date;
import java.util.Map;
import java.util.TreeMap;

import com.wangsh.webforward.common.pojo.BasePojo;

/**
 * 系统配置(系统中存储的变量)
 * 
 * @author TeaBig
 */
public class ASysProperty extends BasePojo<ASysProperty>
{
	private int id;
	private String name;
	private String value;
	private String content;
	private byte status;
	private Date createTime;
	private Date updateTime;
	private Date pubTime;
	
	/* 字符串显示(枚举) */
	private String statusStr;
	
	/*
	 * 方便枚举项在网页上显示出来 键为值(数字), 值为字符串描述 只提供get方法 ,enumsMap将前台所有枚举放到这个map中.前台以value值区分
	 */
	private Map<String, String> enumsMap = new TreeMap<String, String>();

	public Map<String, String> getEnumsMap()
	{
		/* 搜索字符串 */
		String indexStr = "_" ; 
		// 根据状态值获取字符串描述
		ASysPropertyEnum[] enums = ASysPropertyEnum.values();
		for (int i = 0; i < enums.length; i++)
		{
			ASysPropertyEnum enumTemp = enums[i];
			String key = enumTemp.toString();
			if (key.lastIndexOf(indexStr) != -1)
			{
				key = key.substring(0, key.lastIndexOf(indexStr));
			}
			enumsMap.put(key + "-" + enumTemp.getStatus() + "", enumTemp.getName());
		}
		return enumsMap;
	}
	
	public String getStatusStr()
	{
		ASysPropertyEnum[] enums = ASysPropertyEnum.values();
		for (int i = 0; i < enums.length; i++)
		{
			ASysPropertyEnum enumTemp = enums[i];
			if (enumTemp.toString().startsWith("STATUS_"))
			{
				if (enumTemp.getStatus() == this.getStatus())
				{

					this.statusStr = enumTemp.getName();
				}
			}

		}
		return statusStr;
	}

	public int getId()
	{
		return id;
	}

	public void setId(int id)
	{
		this.id = id;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public String getValue()
	{
		return value;
	}

	public void setValue(String value)
	{
		this.value = value;
	}

	public String getContent()
	{
		return content;
	}

	public void setContent(String content)
	{
		this.content = content;
	}

	public byte getStatus()
	{
		return status;
	}

	public void setStatus(byte status)
	{
		this.status = status;
	}

	public Date getCreateTime()
	{
		return createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

	public Date getUpdateTime()
	{
		return updateTime;
	}

	public void setUpdateTime(Date updateTime)
	{
		this.updateTime = updateTime;
	}

	public Date getPubTime()
	{
		return pubTime;
	}

	public void setPubTime(Date pubTime)
	{
		this.pubTime = pubTime;
	}

}
